package com.harmonyos.studyharmonyos;

import com.harmonyos.studyharmonyos.slice.VediosAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.bundle.IBundleManager;
import ohos.security.SystemPermission;

/**
 * 跨设备视频协同
 */
public class MultiJointAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setMainRoute(VediosAbilitySlice.class.getName());
        if (verifySelfPermission(SystemPermission.DISTRIBUTED_DATASYNC) != IBundleManager.PERMISSION_GRANTED) {//如果未授予该权限，则去申请
            if (canRequestPermission(SystemPermission.DISTRIBUTED_DATASYNC)) {//动态权限申请
                requestPermissionsFromUser(new String[]{SystemPermission.DISTRIBUTED_DATASYNC}, 1);
            }
        }
    }
}
